﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.IO;

namespace Ruandao.HostServer
{
    public class JsonHostServerContext : HostServerContext
    {
        internal IDictionary<int, Database> Databases();
        internal IDictionary<int, FileStorage> FileStorages();
        internal IDictionary<int, SiteWare> SiteWares();
        internal IDictionary<Guid, Site> Sites();

        static readonly public JsonHostServerContext Instance = new JsonHostServerContext();

        private JsonHostServerContext()
        {
            string path = HttpContext.Current.Request.PhysicalApplicationPath;
            var folder = new DirectoryInfo(path).Parent.FullName;
            var file = Path.Combine(folder, "HostServer.json");

            if (!File.Exists(file)) throw new Exception("找不到Hoster的json配置文件：" + file + "。");
            
            // 执行反序列化得到对应数据库的5张表的内容。

        }

        public override Site GetCurrentSite()
        {
            throw new NotImplementedException();
        }

        public override Domain GetCurrentDomain()
        {
            throw new NotImplementedException();
        }

        public override SiteWare GetCurrentSiteWare()
        {
            throw new NotImplementedException();
        }
    }
}
